package ru.pachkun.home.pages;

import static org.openqa.selenium.support.ui.ExpectedConditions.presenceOfElementLocated;

import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;

public class MainInfoPage extends Page {

	public MainInfoPage(PageManager pages) {
		super(pages);
	}

	@Override
	public MainInfoPage ensurePageLoaded() {
		super.ensurePageLoaded();
		wait.until(presenceOfElementLocated(By.xpath("//frame[@src='/jsp/index.jsp']")));
		return this;
	}
	
	@FindBy(xpath = "//frame[@src='/jsp/index.jsp']")
	private WebElement mainFrame;
	
	public MainPageFrame switchToMainFrame(){
	    webDriver.switchTo().frame(mainFrame);
		return pages.mainPageFrame;
	}

}
